﻿@model BuildServer.Models.BuildTemplate

@{
    ViewBag.Title = "Build Templates";
    Model.Name += " (Copy)";
}

<h2 class="title"><img src="~/Images/BuildTemplate.png" />@ViewBag.Title - @Model.Name</h2>

<style type="text/css">
    div.show-me-full.is-full {
        position: absolute;
        left: 0px;
        top: 0px;
        right: 0px;
        bottom: 0px;
        background: white;
    }
    
        div.show-me-full.is-full textarea {
        }
</style>

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    @Html.Hidden("source_id", Model.Id)

    <table class="editor-table">
        @Html.EditorRowFor(m => m.Name)
        @Html.EditorRowFor(m => m.WorkingDirectory)
        @Html.EditorRowFor(m => m.BuildScript)
        @Html.EditorRowFor(m => m.BuildProps)
    </table>
    <table>
        <tr>
            <td class="editor-label">@Html.CheckBox("deepcopy", true)</td>
            <td class="editor-field"><label for="deepcopy">Copy Build Definitions</label></td>
        </tr>
    </table>
    <p>
        <input type="submit" value="Create" /> |
        @Html.ActionLink("Back to List", "Index")
    </p>
}

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    <script type="text/javascript">
        $(document).ready(function () {
            $('a.show-me-full').click(function () {
                var div = $(this).closest('div.show-me-full').toggleClass('is-full');
                if (div.hasClass('is-full')) {
                    div.find('textarea').width(div.width() - 10).height(div.height() - $(this).height() - 10);
                } else {
                    div.find('textarea').width('auto').height('auto');
                }
            });
        });

    </script>
}
